home *** CD-ROM | disk | FTP | other *** search
/ Language/OS - Multiplatform Resource Library / LANGUAGE OS.iso / cpp_libs / answrbok / 8_13.lha / 8_13 / tst13b.c < prev    next >
Text File  |  1993-08-08  |  713b  |  36 lines

  1. * Copyright (c) 1990 by AT&T Bell Telephone Laboratories, Incorporated. */
  2. * The C++ Answer Book */
  3. * Tony Hansen */
  4. * All rights reserved. */
  5. include <pat.h>
  6.  
  7. ain()
  8.  
  9.    pat p(cin);
  10.    int x, y;
  11.    float f;
  12.    char s[100];
  13.  
  14.    if (p.match("Name:")) {
  15. cout << "match 1 %s %f %d succeeded\n";
  16. p >> s >> f >> y >> x;
  17.    } else if (p.match("Hello:")) {
  18. cout << "match 2 %s %f %d succeeded\n";
  19. p >> s >> f >> x >> y;
  20.    } else {
  21. cout << "default succeeded\n";
  22. p >> s >> x >> y >> f;
  23.    }
  24.  
  25.    cout << "s = '" << s << "'\n"
  26.         << "x = '" << x << "'\n"
  27.  << "y = '" << y << "'\n"
  28.  << "f = '" << f << "'\n";
  29.  
  30.    int a = -1, b = -2;
  31.    p >> a >> b;
  32.    cout << "a = " << a << "\n"
  33.  << "b = " << b << "\n";
  34.    return 0;
  35.  
  36.